﻿using Library.Collections.Generic;
using Library.Linq.Expressions;
using Library.Logic.Inference;
using Library.Logic.Unification;
using Library.Transactions;
using System.Diagnostics.Contracts;

namespace Library.Logic.Unification
{
    public interface IUnifiableReadOnly
    {
        [Pure]
        bool CanUnify(object[] value);

        [Pure]
        bool CanUnify(object[] value, IMapCollection<VariableExpression, object[]> mappings);
    }

    public interface IUnifiable : IUnifiableReadOnly
    {
        bool Unify(object[] value);
    }

    public interface IUnifiableReasonReadOnly : IUnifiableReadOnly
    {
        [Pure]
        bool CanUnify(object[] value, out IInference argument);

        [Pure]
        bool CanUnify(object[] value, IMapCollection<VariableExpression, object[]> mappings, out IInference argument);
    }

    public interface IUnifiableReason : IUnifiable, IUnifiableReasonReadOnly
    {
        bool Unify(object[] value, out IInference argument);
    }
}

namespace Library.Logic.Transactional
{
    public interface IUnifiableTransactional : IUnifiable
    {
        new ITransaction<bool> Unify(object[] value);
    }

    public interface IUnifiableReasonTransactional : IUnifiableTransactional, IUnifiableReason
    {
        new ITransaction<bool> Unify(object[] value, out IInference argument);
    }
}
